package com.storm.utils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * this class used to get the format date
 * @author liuquan
 * @date 2013-11-26
 *
 */
public class UDate {
	
	private static Date date = new Date();
	private static DateFormat format; 
	/**
	 * get the date of today
	 * @return
	 */
	public static String getByDay(){
		format = new SimpleDateFormat("yyyy.MM.dd");
	    String ret = format.format(date);
		return ret;
	}
	public static String getByHour(){
		format = new SimpleDateFormat("yyyy.MM.dd HH");
		String ret = format.format(date);
		return ret;
	}
	public static String getByMinute(){
		format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
		String ret = format.format(date);
		return ret;
	}
	public static String getBySecond(){
		format = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
		String ret = format.format(date);
		return ret;
	}

	/**
	 * test
	 * @param args
	 */
	public static void main(String[] args){
		System.out.println(UDate.getByDay());
		System.out.println(UDate.getByHour());
		System.out.println(UDate.getByMinute());
		System.out.println(UDate.getBySecond());
		
	}
}
